package com.lc.servlet;

import com.lc.bean.Grade;
import com.lc.service.GradeService;
import com.lc.service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @description:获取年级列表的servlet
 * @author: ManolinCoder
 * @time: 2021/8/22
 */
@WebServlet("/Educational/student/getGradeList")
public class GradeListServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调用查询年级列表的方法
        GradeService gradeService = new GradeServiceImpl();
        List<Grade> gradeList = gradeService.getList();
        req.setAttribute("glist",gradeList);
        req.getRequestDispatcher("add.jsp").forward(req,resp);
    }
}
